﻿package com.bizmlib.utils
{
	public function mixRGBColors(colorA:Number, colorB:Number, proportion:Number):Number
	{
		proportion = Math.max(0, Math.min(1, proportion));
		
		var colorAComponents:Object = colorToRGBComponents(colorA);
		var colorBComponents:Object = colorToRGBComponents(colorB);
		var resultR:Number = colorAComponents.red + (colorBComponents.red - colorAComponents.red)*proportion;
		var resultG:Number = colorAComponents.green + (colorBComponents.green - colorAComponents.green)*proportion;
		var resultB:Number = colorAComponents.blue + (colorBComponents.blue - colorAComponents.blue)*proportion;
		return resultR<<16 | resultG<<8 | resultB;
	}
}